package com.training.service;

import com.jfinal.plugin.activerecord.Page;
import com.training.common.model.Menu;

import java.util.List;

public class MenuServiceImp implements MenuService {


    @Override
    public Page<Menu> getMenuPage(int pageNumber,int pageSize,String menuName) {
        return Menu.dao.getMenuPage(pageNumber,pageSize,menuName);
    }

    @Override
    public boolean addMenu(Menu menu) {
        return menu.save();
    }

    @Override
    public boolean removeMenu(int menuid) {
        return Menu.dao.deleteById(menuid);
    }

    @Override
    public boolean editMenu(Menu menu) {
        return menu.update();
    }

    @Override
    public Menu showMenu(int menuid) {
        return Menu.dao.findById(menuid);
    }

    @Override
    public List<Menu> getMenuTree(){
        return Menu.dao.getMenuTree();
    }

    @Override
    public List<Menu> getMenuTreetrue(String roleid) {
        return Menu.dao.getMenuTreetrue(roleid);
    }


}
